/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Current.Armory;

import Current.Armory.Items.SpyOffenseItems;

import java.io.Serializable;

/**
 * @author tiago
 */
public class SpyOffenseArmory implements Armory, Serializable, Cloneable {

    private SpyOffenseItems weapons;
    private SpyOffenseItems helms;
    private SpyOffenseItems armors;
    private SpyOffenseItems boots;
    private SpyOffenseItems bracers;
    private SpyOffenseItems shields;
    private Integer spies;

    public SpyOffenseArmory(Integer spies, SpyOffenseItems weapons, SpyOffenseItems helms, SpyOffenseItems armor, SpyOffenseItems boots, SpyOffenseItems bracers, SpyOffenseItems shields) {
        this.weapons = weapons;
        this.helms = helms;
        this.armors = armor;
        this.boots = boots;
        this.bracers = bracers;
        this.shields = shields;
        this.spies = spies;
    }

    public SpyOffenseArmory(Integer spies) {
        this.weapons = new SpyOffenseItems(0, 12500, 25);
        this.helms = new SpyOffenseItems(0, 3000, 6);
        this.armors = new SpyOffenseItems(0, 9500, 19);
        this.boots = new SpyOffenseItems(0, 3000, 6);
        this.bracers = new SpyOffenseItems(0, 1500, 3);
        this.shields = new SpyOffenseItems(0, 6000, 12);
        this.spies = spies;
    }

    public SpyOffenseItems getArmors() {
        return armors;
    }

    public void setArmor(SpyOffenseItems armors) {
        this.armors = armors;
    }

    public SpyOffenseItems getBoots() {
        return boots;
    }

    public void setBoots(SpyOffenseItems boots) {
        this.boots = boots;
    }

    public SpyOffenseItems getBracers() {
        return bracers;
    }

    public void setBracers(SpyOffenseItems bracers) {
        this.bracers = bracers;
    }

    public SpyOffenseItems getHelms() {
        return helms;
    }

    public void setHelms(SpyOffenseItems helms) {
        this.helms = helms;
    }

    public SpyOffenseItems getShields() {
        return shields;
    }

    public void setShields(SpyOffenseItems shields) {
        this.shields = shields;
    }

    public SpyOffenseItems getWeapons() {
        return weapons;
    }

    public void setWeapons(SpyOffenseItems weapons) {
        this.weapons = weapons;
    }

    public int getSetSpyOffenseBonus() {
        int aux = 0;

        aux += this.weapons.getSpyOffenseBonus();
        aux += this.helms.getSpyOffenseBonus();
        aux += this.armors.getSpyOffenseBonus();
        aux += this.boots.getSpyOffenseBonus();
        aux += this.bracers.getSpyOffenseBonus();
        aux += this.shields.getSpyOffenseBonus();

        return aux;
    }

    public int getSetCost() {
        int aux = 0;

        aux += this.weapons.getCostToBuy();
        aux += this.helms.getCostToBuy();
        aux += this.armors.getCostToBuy();
        aux += this.boots.getCostToBuy();
        aux += this.bracers.getCostToBuy();
        aux += this.shields.getCostToBuy();

        return aux;
    }

    private int getSpyOffenseFromWeapons() {
        if (this.weapons.getHave() >= spies) {
            return this.weapons.getSpyOffenseBonus() * spies;
        } else {
            return this.weapons.getSpyOffenseBonus() * this.weapons.getHave();
        }
    }

    private int getSpyOffenseFromHelms() {
        if (this.helms.getHave() >= spies) {
            return this.helms.getSpyOffenseBonus() * spies;
        } else {
            return this.helms.getSpyOffenseBonus() * this.helms.getHave();
        }
    }

    private int getSpyOffenseFromArmors() {
        if (this.armors.getHave() >= spies) {
            return this.armors.getSpyOffenseBonus() * spies;
        } else {
            return this.armors.getSpyOffenseBonus() * this.armors.getHave();
        }
    }

    private int getSpyOffenseFromBoots() {
        if (this.boots.getHave() >= spies) {
            return this.boots.getSpyOffenseBonus() * spies;
        } else {
            return this.boots.getSpyOffenseBonus() * this.boots.getHave();
        }
    }

    private int getSpyOffenseFromBracers() {
        if (this.bracers.getHave() >= spies) {
            return this.bracers.getSpyOffenseBonus() * spies;
        } else {
            return this.bracers.getSpyOffenseBonus() * this.bracers.getHave();
        }
    }

    private int getSpyOffenseFromShields() {
        if (this.shields.getHave() >= spies) {
            return this.shields.getSpyOffenseBonus() * spies;
        } else {
            return this.shields.getSpyOffenseBonus() * this.shields.getHave();
        }
    }

    public int getTotalSpyOffenseBonus() {
        int aux = 0;

        aux += getSpyOffenseFromWeapons();
        aux += getSpyOffenseFromHelms();
        aux += getSpyOffenseFromArmors();
        aux += getSpyOffenseFromBoots();
        aux += getSpyOffenseFromBracers();
        aux += getSpyOffenseFromShields();

        return aux;
    }

    public Integer getSpies() {
        return spies;
    }

    public void setSpies(Integer spies) {
        this.spies = spies;
    }


}
